﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace TradeMo
{
    public class UniquePossitiveConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null) return "";
            int uniquePositive = (int)value;

            if (uniquePositive > 50000) return "/Images/star50000.png";
            if (uniquePositive > 40000) return "/Images/star40000.png";
            if (uniquePositive > 30000) return "/Images/star30000.png";
            if (uniquePositive > 20000) return "/Images/star20000.png";
            if (uniquePositive > 10000) return "/Images/star10000.png";
            if (uniquePositive > 5000) return "/Images/star5000.png";
            if (uniquePositive > 4000) return "/Images/star4000.png";
            if (uniquePositive > 3000) return "/Images/star3000.png";
            if (uniquePositive > 2000) return "/Images/star2000.png";
            if (uniquePositive > 1500) return "/Images/star1500.png";
            if (uniquePositive > 1000) return "/Images/star1000.png";
            if (uniquePositive > 500) return "/Images/star500.png";
            if (uniquePositive > 200) return "/Images/star200.png";
            if (uniquePositive > 100) return "/Images/star100.png";
            if (uniquePositive > 50) return "/Images/star50.png";
            if (uniquePositive > 10) return "/Images/star10.png";
            if (uniquePositive > 0) return "/Images/star.png";
            return "";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
